package com.twq.oo.packandimpo

class NavigatorTest


package com.twq.oo.packandimpo {

  class NavigatorTest

}

/**
 * Created by tangweiqun on 2017/12/1.
 */
object PackageTest {
  //两种方式组织package
  def main(args: Array[String]): Unit = {

    //每一个package中都允许定义一个package object
    testPackageObject
  }
}


package com {
  package twq {

    class Navigator {

      val map = new StarMap
    }

    class StarMap

  }

  class Ship {

    val nav = new com.twq.Navigator
  }
  package fleets {

    class Fleet {

      def addShip() = {
        new Ship
      }
    }

  }

}


package bobsrockets {

  class Ship

}

package bobsrockets.fleets {

  class Fleet {
    //编译不过
    def addShip() = {
      new bobsrockets.Ship
    }
  }

}



